Skip to content

Conversation

@brenuart
Copy link
Collaborator

@brenuart brenuart commented Sep 6, 2021

Keep current behaviour for backward compatibility.
Emit a WARN status when the property is set.

fixes #633

Deprecate AbstractLogstashTcpSocketAppender#secondaryConnectionTTL in a backward compatible way (emit a warning if the propery is set during configuration)

fixes #633
@brenuart brenuart requested a review from philsttr September 6, 2021 21:41
*/
@Deprecated
public void setSecondaryConnectionTTL(Duration secondaryConnectionTTL) {
addWarn("Setting <secondaryConnectionTTL> on the appender is deprecated, set it on the connection strategy using <preferPrimary.secondaryConnectionTTL> instead.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<preferPrimary.secondaryConnectionTTL> is a little confusing, since it looks like xml, but is not the way the value would be set in xml.

Perhaps <preferPrimary><secondaryConnectionTTL> would be better? I'm looking for better ideas. (?)

Copy link
Collaborator Author

@brenuart brenuart Sep 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came across this issue several times already when throwing exceptions for invalid properties for instance.

I initially though that using an XML-like name was a good idea certainly if we consider that most users will use an XML file to configure their logging system. If we follow this approach then <preferPrimary><secondaryConnectionTTL> is certainly better.

Another option is to opt for a JavaBean-style format and do something like "preferPrimary.secondaryConnectionTTL". But this looks weird to me...

In this particular case, maybe we could simply say Setting <secondaryConnectionTTL> directly on the appender is deprecated. Instead you should explicitly set the connection strategy to <preferPrimary> and set its <secondaryConnectionTTL> property to the desired value.

What ever option we choose, we should probably review the other classes and standardise on the chosen naming convention...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting <secondaryConnectionTTL> directly on the appender is deprecated. Instead you should explicitly set the connection strategy to <preferPrimary> and set its <secondaryConnectionTTL> property to the desired value.

^ I like that.

What ever option we choose, we should probably review the other classes and standardise on the chosen naming convention

Agreed.

@brenuart brenuart merged commit 6e917b7 into main Sep 7, 2021
@brenuart brenuart deleted the gh633-deprecate-setSecondaryTTL branch September 7, 2021 10:57
@philsttr philsttr added this to the 7.0 milestone Nov 13, 2021
@philsttr philsttr added the warn/deprecation Changes about to deprecate feature/methods/fields label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

warn/deprecation Changes about to deprecate feature/methods/fields

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate AbstractLogstashTcpSocketAppender#secondaryConnectionTTL

3 participants